package com.xiaoshuidi.cloud.module.report.constant;

import cn.hutool.core.util.ObjectUtil;

public enum DeviceTypeEnum {

    AMMETER("ammeter","电表"),
    COLD_WATER_METER("cold_watermeter","冷水表"),
    DOOR_LOCK("doorlock","门锁"),
    HOT_WATER_METER("hot_watermeter","热水表"),

    ;

    private String node;

    private String desc;

    public String getNode() {
        return node;
    }

    public String getDesc() {
        return desc;
    }

    DeviceTypeEnum(String node, String desc) {
        this.node = node;
        this.desc = desc;
    }

    public static DeviceTypeEnum getEnumByNode(Object node){
        if(ObjectUtil.isNull(node)){
            return null;
        }
        for (DeviceTypeEnum typeEnum : DeviceTypeEnum.values()) {
            if(typeEnum.getNode().equals(node.toString())){
                return typeEnum;
            }
        }
        return null;
    }
}
